﻿using IOFileServer.ZMPhoneticEnglish.Models;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using System;
using System.Collections.Generic;
using System.Text;

namespace IOFileServer.Test.ZMPhoneticEnglish
{
    public static class AssertExtend
    {
        public static void Check(string arrSets, int[][] datas, int index)
        {
            Assert.IsNotNull(datas);
            Assert.IsTrue(datas.Length > 0);

            Assert.IsTrue(index >= 0);
            Assert.IsTrue(index < datas.Length);

            int[] arr = datas[index];
            Assert.IsNotNull(arr);
            Assert.IsTrue(arr.Length > 0);

            string arr_str = $"[{string.Join(",", arr)}]";
            Assert.AreEqual(arrSets, arr_str);
        }
        public static void Check(string Sign, string Pronunciation, WordPronunciationRule[] ruleSet, int index)
        {
            Assert.IsNotNull(ruleSet);
            Assert.IsTrue(ruleSet.Length > 0);

            Assert.IsTrue(index >= 0);
            Assert.IsTrue(index < ruleSet.Length);

            WordPronunciationRule rule = ruleSet[index];
            Assert.IsNotNull(rule);

            Assert.AreEqual(Sign, rule.Sign);
            Assert.AreEqual(Pronunciation, rule.Pronunciation);
        }
        public static void Check_Combined(WordPronunciationCalcResult r, int CombinedIndex, string CombinedPositionArr, string RuleBindArr)
        {
            Assert.IsNotNull(r);
            Check(CombinedPositionArr, r.CombinedPosition, CombinedIndex);
            Check(RuleBindArr, r.CombinedPositionAndRuleBind, CombinedIndex);
        }
    }
}
